//
//  scanDetailController.m
//  SSSAllRollAgency
//
//  Created by Darker on 2017/3/16.
//  Copyright © 2017年 Darker. All rights reserved.
//

#import "scanDetailController.h"
#import "WSLineChartView.h"

@interface scanDetailController ()

@end

@implementation scanDetailController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.title = @"善心走势";
    //去掉透明后导航栏下边的黑边
    //    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    self.navigationController.navigationBar.hidden = NO;
    
    self.view.backgroundColor = [UIColor colorWithHex:@"F9F9FA"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //初始化界面
    [self setUpApperance];
    
}
#pragma mark - 初始化界面
- (void)setUpApperance{
    
    UIView *blackBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 64+HeigthIos6CompeteWithCurrent(5), KSCREEN_Width, HeigthIos6CompeteWithCurrent(301))];
    blackBgView.backgroundColor = [UIColor colorWithHex:@"FFFFFF"];
    [self.view addSubview:blackBgView];
    
    //过去七天的走势
    UILabel *selevenLabel = [[UILabel alloc]init];
    selevenLabel.text = @"过往七天的走势";
    selevenLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    selevenLabel.font = [SSSFont systemFontOfSize:15];
    selevenLabel.textAlignment = NSTextAlignmentLeft;
    [blackBgView addSubview:selevenLabel];
    selevenLabel.sd_layout
    .topSpaceToView(blackBgView,HeigthIos6CompeteWithCurrent(19))
    .leftSpaceToView(blackBgView,WidthIos6CompeteWithCurrent(15))
    .heightIs(HeigthIos6CompeteWithCurrent(14))
    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:selevenLabel.text font:selevenLabel.font height:HeigthIos6CompeteWithCurrent(22)]);
    
    //UILabel
    UILabel *descLabel = [[UILabel alloc]init];
    descLabel.text = @"(2017-03-15 星期三)";
    descLabel.textColor = [UIColor colorWithHex:@"F5F5F5"];
    descLabel.font = [SSSFont systemFontOfSize:12];
    descLabel.textAlignment = NSTextAlignmentLeft;
    [blackBgView addSubview:descLabel];
    descLabel.sd_layout
    .bottomEqualToView(selevenLabel)
    .leftSpaceToView(selevenLabel,WidthIos6CompeteWithCurrent(5))
    .heightIs(HeigthIos6CompeteWithCurrent(10))
    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:descLabel.text font:descLabel.font height:HeigthIos6CompeteWithCurrent(10)]);
    
    
    //折线图
//    ZDChartView *chartView = [ZDChartView charView];
//    chartView.frame = CGRectMake(WidthIos6CompeteWithCurrent(28), HeigthIos6CompeteWithCurrent(71),KSCREEN_Width - WidthIos6CompeteWithCurrent(60), HeigthIos6CompeteWithCurrent(130));
//    [blackBgView addSubview:chartView];
//    chartView.xValues = @[@"0",@"3-9",@"3-10",@"3-11",@"3-12",@"3-13",@"3-14"];
//    chartView.yValues = @[@"4.0",@"3.0",@"3.5",@"2.5",@"4.0",@"2.5",@"3.5"];
//    chartView.chartColor = [UIColor colorWithHex:@"108279"];
//    chartView.chartWidth = 2;
//    chartView.sd_layout
//    .topSpaceToView(descLabel,HeigthIos6CompeteWithCurrent(38))
//    .leftSpaceToView(blackBgView,WidthIos6CompeteWithCurrent(28))
//    .rightSpaceToView(blackBgView,WidthIos6CompeteWithCurrent(20))
//    .heightIs(HeigthIos6CompeteWithCurrent(130));
    
    NSMutableArray *xArray = [NSMutableArray array];
    NSMutableArray *yArray = [NSMutableArray array];
    xArray = [NSMutableArray arrayWithObjects:@"3.9",@"3.10",@"3.11",@"3.12",@"3.13",@"3.14",@"3.15", nil];
    yArray = [NSMutableArray arrayWithObjects:@"4.5",@"1.5",@"3.2",@"4.8",@"5.9",@"2.6",@"4.3", nil];
    
    
    WSLineChartView *wsLine = [[WSLineChartView alloc]initWithFrame:CGRectMake(WidthIos6CompeteWithCurrent(28), HeigthIos6CompeteWithCurrent(71),KSCREEN_Width - WidthIos6CompeteWithCurrent(40), HeigthIos6CompeteWithCurrent(130)) xTitleArray:xArray yValueArray:yArray yMax:5 yMin:0];
    wsLine.backgroundColor = [UIColor clearColor];
    [blackBgView addSubview:wsLine];
    
    
    //添加文字
    UILabel *titleLabel = [[UILabel alloc]init];
    titleLabel.text = @"善心走势每日将不同，善心走势每日都将不同，善心走势每日将不同，善心走势每日都将不同，善心走势每日将不同，善心走势每日都将不同";
    titleLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    titleLabel.font = [SSSFont systemFontOfSize:11];
    [blackBgView addSubview:titleLabel];
    titleLabel.sd_layout
    .topSpaceToView(wsLine,HeigthIos6CompeteWithCurrent(47))
    .leftSpaceToView(blackBgView,WidthIos6CompeteWithCurrent(17))
    .rightSpaceToView(blackBgView,WidthIos6CompeteWithCurrent(17))
    .autoHeightRatio(0);
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
